home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / dev / misc / gadoc.lha / GAdoc.c / Docs / GAdoc.doc < prev    next >
Encoding:
Text File  |  1995-03-28  |  15.9 KB  |  486 lines

  1.  
  2.  
  3.  
  4.  
  5.                                  GAdoc
  6.  
  7.    A program to extract the autodocs from your source files.
  8.  
  9.    `Get Autodoc' generates a texinfo file, which can be converted into
  10. a .dvi file with TeX or into a hypertext using makeinfo.
  11.  
  12.    GAdoc was done by
  13.  
  14.          Gerhard Leibrock
  15.          Neuhäuselerstr. 12
  16.          D-66459 Kirkel
  17.          Germany
  18.      
  19.      
  20.          Tel.: 06849 / 6134
  21.          INTERNET: leibrock@fsinfo.cs.uni-sb.de
  22.                    fach5@cipsol.cs.uni-sb.de
  23.  
  24. Copyright
  25. *********
  26.  
  27.                            GAdoc, March 1995
  28.  
  29.    (C) 1995 by Gerhard Leibrock
  30.  
  31.    This software is subject to the "Standard Amiga FD-Software
  32. Copyright Note".  It is Cardware as defined in paragraph 4.c.  If you
  33. like it and use it regularly please send a postcard to the author.  For
  34. more information please read "AFD-COPYRIGHT" (Version 1 or higher).
  35.  
  36. Requirements
  37. ************
  38.  
  39.                          Amiga computer family
  40.  
  41.    The minimal configuration for running this program is at least 1MB
  42. of free RAM. If you got a compiled version of the program, you need at
  43. least OS 2.04, too, because it got compiled using gcc263 and this is an
  44. 2.x only compiler.
  45.  
  46.    If you want to use the `-aicon' option, you should use Amiga OS 3.0
  47. at least, since this icon calls multiview, which gets shipped with OS
  48. 3.0 and later versions.
  49.  
  50.                                 Others
  51.  
  52.    To recompile GAdoc, you need an ANSI/C compiler, GNU/C works.  Just
  53. type in "make" (using gcc) and wait.
  54.  
  55.    If you want to use this program with MS-DOS, you have to alter the
  56. file extexsions, of the generated programs, otherwise the program might
  57. not work at all.
  58.  
  59.    Using this piece of software with U*IX computers caused no problem
  60. with SOLARIS and NetBSD. Use it at your own risk on other architectures.
  61.  
  62. Installation
  63. ************
  64.  
  65.    Just copy the executable to somewhere in your path.
  66.  
  67. What are autodocs?
  68. ******************
  69.  
  70.    Every programmer knows about the problems of software documentation
  71. or problems that arise from team work.
  72.  
  73.    After having finished a project or a part of it, you are glad that
  74. it works at all, but what about your partner or your boss? They also
  75. want to have the functions documented, if possible printed on paper.
  76.  
  77.    Now you have to sit down again and write down all what you know
  78. about your functions. But what happens after you change some parts of
  79. your functions, or add some ...? Your documentation will have to be
  80. rewritten.
  81.  
  82.    That's really a problem that also affects big firms, not only hobby
  83. programmers. There exist several systems, that allow you to write your
  84. program and documentation at the same time, like cweb does. cweb is
  85. great and very powerful, but most of the time, programmers need
  86. something more simple, this is the time where autodocs enter your life.
  87.  
  88.    Autodocs are easy to use within your source code, no matter which
  89. language you use, you only need a language, that allows you to use
  90. blocks of comments.
  91.  
  92. Starting a project
  93. ==================
  94.  
  95.    Every source file should start with an autodoc, that describes your
  96. project and gives GAdoc information about the author, the copyright
  97. holder etc.
  98.  
  99.    Here is an example:
  100.  
  101.      /****h* project/Intro ***
  102.      *
  103.      * NAME
  104.      *  project
  105.      *
  106.      * COPYRIGHT
  107.      *  No name software, inc.
  108.      *
  109.      * FUNCTION
  110.      *   This project is a project about projects.
  111.      *
  112.      * AUTHOR
  113.      *  Gerhard Leibrock
  114.      *
  115.      * VERSION
  116.      *  1.0
  117.      *
  118.      * NOTES
  119.      *  Its not the size of the ship, its the size of the waves.
  120.      *  LITTLE RICHARD
  121.      *
  122.      *
  123.      ***/
  124.  
  125.    The first character of the first line gets ignored, then the line is
  126. checked for 4 asterisks followed by "h*" and a space.
  127.  
  128. `Note:'
  129.      Because GAdoc supports the usage of IDs that can be written
  130.      instead of   the 2nd and 3rd asterisk, it is also possible to
  131.      begin the autodoc entry   with something different from "/****h*",
  132.      e.g. it can begin with   "/*IT*h*", if you choose "IT" as your
  133.      favourite ID, maybe to indicate   a header written in italian.
  134.      These special autodoc entries can only be   extracted using the
  135.      `-s' argument. This flag can also be used to group   special
  136.      functions, e.g. an ID like "WD" could specify the function as a
  137.      special Window function, or something like that.
  138.  
  139.      The two asterisks at the 2nd and 3rd position can be seen as the
  140.      default   ID.
  141.  
  142.    After this "begin" keyword you have to specify the name of the
  143. project followed by a slash ("/") and a short description (Could also be
  144. "project/TheNameOfTheGame").
  145.  
  146.    The keywords have the following meaning:
  147.  
  148. `NAME'
  149.      What's the name of your software?
  150.  
  151. `COPYRIGHT'
  152.      Who holds the copyright?
  153.  
  154. `FUNCTION'
  155.      What can be done with this program?
  156.  
  157. `AUTHOR'
  158.      Who wrote the software?
  159.  
  160. `VERSION'
  161.      Version number, remeber that the numbers should be read as real
  162.      decimals, meaning a Version number of 1.4 (one-point-4) refers to
  163.      an older release than a number of 1.11 (one-point-eleven).
  164.  
  165. `NOTES'
  166.      Bugs, features, statements, etc.
  167.  
  168.    Remember that this "header" must be specified before any other
  169. autodoc, otherwise, GAdoc will cease its operation and give you an
  170. error message.
  171.  
  172.    It is impossible not to specify the header. GAdoc will fill out the
  173. author's name with Unknown, the version number with 0.0 and other vague
  174. values.
  175.  
  176.    Also remember the order of the keywords, meaning `NAME' should be
  177. specified before `NOTES', etc..
  178.  
  179.    You should take a look at the GAdoc source code, which gets
  180. delivered with gadoc.
  181.  
  182. Function description
  183. ====================
  184.  
  185.    Here is an example of an autodoc for a function within C-source code:
  186.  
  187.      /****** misc/ShowReq *****
  188.      *
  189.      * NAME
  190.      *  ShowReq -- Shows a requester (Needs at least KS 1.3)
  191.      *
  192.      * SYNOPSIS
  193.      *   void = ShowReq( Title, Text);
  194.      *                     D0   D1
  195.      *
  196.      *   void ShowReq ( STRPTR, STRPTR);
  197.      *
  198.      * FUNCTION
  199.      *   Display a requester with title and some text.
  200.      *
  201.      * INPUTS
  202.      *   Title  - Title of the requester
  203.      *   Text   - Message for the user
  204.      *
  205.      * RESULT
  206.      *   None
  207.      *
  208.      * EXAMPLE
  209.      *   ShowReq("J EDGAR HOOVER", "I regret to say that we of the FBI are\\n"
  210.      *                             "powerless to act in cases of oral-genital\\n"
  211.      *                             "intimacy, unless it has in some way\\n"
  212.      *                             "obstructed interstate commerce.");
  213.      *
  214.      *
  215.      * NOTES
  216.      *   Will not work on Amigas with Kickstart version < 1.3
  217.      *
  218.      * BUGS
  219.      *
  220.      *
  221.      * SEE ALSO
  222.      *   special/ShowTextAndPictureReq
  223.      *
  224.      ***/
  225.  
  226.    An autodoc for functions is recognized through the sequence of six
  227. asterisks ("******"), the first character gets ignored (Here the "/").
  228. Then follows a blank and the name of the module followed by "/" and the
  229. functions name. The rest of the line gets ignored.
  230.  
  231.    Here some valid examples:
  232.  
  233.      /****** module/name ------------------------------
  234.      ;****** module/name ------------------------------
  235.      ******* module/name ------------------------------
  236.  
  237.    This marks six asterisks as a special keyword, which should be used
  238. very carefully.
  239.  
  240. `Note:'
  241.      Because GAdoc supports the usage of IDs that can be written
  242.      instead of   the 2nd and 3rd asterisk, it is also possible to
  243.      begin the autodoc entry   with something different from "******"
  244.      (6 asterisks), e.g. it can   begin with "/*IT***", maybe to
  245.      indicate an entry written in italian.    These special autodoc
  246.      entries can only be extracted using the `-s'   argument. This flag
  247.      can also be used to group special functions, e.g.    an ID like
  248.      "WD" could specify the function as a special Window   function, or
  249.      something like that.
  250.  
  251.      The two asterisks could be seen as the "default ID".
  252.  
  253.    After this "begin" statement follows the description of the
  254. functions.  You can use some of the following keywords to describe it:
  255.  
  256. `NAME'
  257.      Put in the function's name, followed by two minus ("-") symbols and
  258.       a one line description. You should write sentences, ending with
  259.      a period   (".").
  260.  
  261. `SYNOPSIS'
  262.      It consists of three parts: The calling convention, the assembly
  263.      registers   and the function prototype. The line with the
  264.      prototype should be   "ready to compile". Take care of this (This
  265.      doesn't matter to GAdoc,   but "autodoc" as shipped with the 3.1
  266.      Amiga Developer Update, requires   this.
  267.  
  268. `FUNCTION'
  269.      Describe what your function does, try to avoid jargon and use
  270.      generally   accepted english. Write as much as needed but as short
  271.      as possible.
  272.  
  273. `INPUTS'
  274.      Describe the parameter's valid range and tell the reader what
  275.      happens,   it you receive e.g. a NULL-pointer or something like
  276.      that.    Use the variable name specified in the SYNOPSIS line and
  277.      use a minus   ("-") as a seperator (See example above).
  278.  
  279. `RESULT'
  280.      Describe the return values and error conditions, as error messages
  281.      ar   also seen as a kind of return value.
  282.  
  283. `EXAMPLE'
  284.      `Short' example of how to use your function. Test the example to
  285.      avoid   misunderstandings.
  286.  
  287. `NOTES'
  288.      Hints, warnings, tricks: Talk about side effects (If they exist),
  289.      etc.
  290.  
  291. `BUGS'
  292.      If your function has bugs, please describe them. Otherwise ignore
  293.      this.
  294.  
  295. `SEE ALSO'
  296.      If your function needs assistance of other functions, or you want
  297.      the   user to scan e.g. include files, list them here. GAdoc
  298.      recognizes references   to other modules ad generates a cross
  299.      link! But therefore, the name   before the "/" `must' be identical
  300.      to the file, where the function   is located.
  301.  
  302.    It is very important, that you use the keywords in the order listed
  303. above.  You might ignore some of them, so GAdoc will replace them with
  304. empty ones.
  305.  
  306.    An autodoc ends with at least three asterisks at the start of a line
  307. ("***").
  308.  
  309.    Please do not use any tabs within your autodos since they are of no
  310. use with makeinfo or TeX.
  311.  
  312. Internal functions
  313. ==================
  314.  
  315.    If you do have functions, that should not be documented to others
  316. for any reason, you should mark them with "****i*" (four asterisks, "i",
  317. one asterisk). These functions will only be extracted if you specify the
  318. "-i" option with GAdoc.
  319.  
  320. `Note:'
  321.      Because GAdoc supports the usage of IDs that can be written
  322.      instead of   the 2nd and 3rd asterisk, it is also possible to mark
  323.      the autodoc entry   with something different from "****i*", e.g.
  324.      it could look like   "*IT*i*", maybe to indicate a header written
  325.      in italian. These   special autodoc entries can only be extracted
  326.      using the `-s'   argument. The two asterisks could be seen as the
  327.      "default ID".
  328.  
  329.    The syntax for internal functions is identical to that of normal
  330. functions.
  331.  
  332. How to use GAdoc
  333. ****************
  334.  
  335.    GAdoc can be used from any shell and accepts the following
  336. parameters:
  337.  
  338.    gadoc <source> <output> [-i -c -s<id> -amiga  -aicon]
  339.  
  340. `<source>:'
  341.      Name of the source files
  342.  
  343. `<output>:'
  344.      Name of the generated files <output>.menu, <output>.data
  345.      (Existing files with identical names will be deleted without
  346.      warning!)
  347.  
  348. `-i'
  349.      Also extract internal autodocs
  350.  
  351. `-c'
  352.      Convert `\\*' (Backslash asterisk) to `/*' and  ``\\*' to `*/'
  353.      (Important for C compilers, that do   not allow nested comments,
  354.      and this may happen, if you write down   C-comments within your
  355.      autodoc).
  356.  
  357. `-s<id>'
  358.      If you want to write the documentation in different languages, than
  359.       you can specify a special ID, for which every autodoc entry gets
  360.      checked.    If the entry matches the two character ID, than the
  361.      autodoc gets extracted,   otherwise it won't get touched.    This
  362.      special ID must be specified as the third and fourth character of
  363.      the   beginning line of the autodoc.
  364.  
  365.                        Standard          Using ``GB'' as ID
  366.                         1234567              1234567
  367.           
  368.           internal      ?****i*              ?*GB*i*
  369.           usual         ?******              ?*GB***
  370.           header        ?****h*              ?*GB*h*
  371.           
  372.           ? := any character
  373.  
  374.      E.g. you want to extract all autodocs written in german, so you
  375.      could   use "DE" as ID for each german autodoc entry. Then you can
  376.      call   `GAdoc' with the option "-sDE" and all autodocs that have
  377.      "DE" will be extracted.
  378.  
  379.      Default is "**". This makes it easy for you to write multi-language
  380.       autodocs and keep them together in one file.
  381.  
  382. `-amiga'
  383.      Include amiga support for texinfo file
  384.  
  385. `-aicon'
  386.      If this flag is specified, gadoc will create an icon with the name
  387.      "<output>.guide.info". This file is only useful for people that
  388.      do use an Amiga computer, otherwise the created icon will be
  389.      worthless.   After creating the guide file with makeinfo, you will
  390.      be able to use  the icon from workbench by just clicking on it and
  391.      it will be loaded  into multiview (Workbench 3.0 required at
  392.      least).
  393.  
  394.    The lines for the autodocs are limited to 80 chars/line.
  395.  
  396.    GAdoc reads the specified source file and generates two files with
  397. the extensions .menu and .data. The file with the .menu extension is
  398. considered to be the main part of the generated texinfo file.
  399.  
  400. The texinfo format
  401. ==================
  402.  
  403.    Texinfo is a documentation system that uses a single source file to
  404. produce both on-line information and printed output.
  405.  
  406.    To produce on-line information like plain ascii text or hypertext
  407. format, you need a program called makeinfo.
  408.  
  409.    It will generate a plain ascii file (Here: "output.doc"), if you
  410. invoke it like that:
  411.  
  412.      makeinfo --no-headers -o output.doc output.menu
  413.  
  414.    If you want to generate a gnu infoview file, you should invoke
  415. makeinfo with just the filename:
  416.  
  417.      makeinfo output.menu
  418.  
  419.    It will generate a file "output.guide", as this name is specified in
  420. output.menu.
  421.  
  422.    If you want to generate amiga specific files, use the "--amiga"
  423. flag, e.g.  to generate the amiga hypertext format for amigaguide:
  424.  
  425.      makeinfo --amiga output.menu
  426.  
  427.    To generate a .dvi file with TeX, just call virtex with the following
  428. parameters:
  429.  
  430.      virtex output.menu
  431.  
  432.    Make  sure,  you have the texinfo includes available to use it with
  433. virtex.  (If  you  use  a  special  amiga version, you need
  434. amigatexinfo also, but I never needed it at all.)
  435.  
  436. Error messages
  437. **************
  438.  
  439. ``-xy': Specified twice (See argument # `n')'
  440.      You specififed the parameter -xy twice.
  441.  
  442. `Unknown argument: <arg>'
  443.      The argument <arg> that you specified in the command line is
  444.      unknown   to GAdoc. Remeber that arguments with a minus ("-") are
  445.      only accepted   in lower case letters.
  446.  
  447. `Could not open file ``<fname>''.'
  448.      GAdoc could not open the requested file, maybe you should check its
  449.       spelling (Some OS distinguish between lower case and upper case
  450.      letters.)
  451.  
  452. `Error Line `n': Either keyword <key> used twice or in wrong order.'
  453.      Maybe you did specify a keyword more then one time in one function
  454.       description, or you used the keywords in wrong order.
  455.  
  456. `Error: End of file occured during internal docs.'
  457.      Maybe you forgot the three asterisks to end this internal
  458.      documentation.
  459.  
  460. `Error Line `n': Header specified after autodocs.'
  461.      The header is to be specified before any other autodoc.
  462.  
  463. `Error Line `n': Second time header gets specified.'
  464.      You did specify two header sections.
  465.  
  466. `Error: End of file occured during internal block.'
  467.      During reading an autodoc for an internal function, an END OF FILE
  468.       signal occured, maybe you forgot to specify the end marker.
  469.  
  470. Index
  471. *****
  472.  
  473.  
  474.  
  475.  Copyright                              Copyright
  476.  Error messages                         Error messages
  477.  Function description                   Function description
  478.  How to use GAdoc                       How to use GAdoc
  479.  Installation                           Installation
  480.  Internal functions                     Internal functions
  481.  Requirements                           Requirements
  482.  Starting a project                     Starting a project
  483.  The texinfo format                     The texinfo format
  484.  What are autodocs?                     What are autodocs?
  485.  
  486.